]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
PopupSwitchMenuItem: allow toggling without closing the menu
authorGiovanni Campagna <gcampagna@src.gnome.org>
Mon, 21 Nov 2011 13:16:51 +0000 (14:16 +0100)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Mon, 6 Feb 2012 15:49:15 +0000 (16:49 +0100)
Similar to what Gtk does, now toggling with Space does not close
the menu.

https://bugzilla.gnome.org/show_bug.cgi?id=664416

js/ui/popupMenu.js
js/ui/userMenu.js

index aca4ae3de15203aca1db26a2586da8e109c3ecd6..58ca000fa7655d13125d1be1514b6514a8eb1d83 100644 (file)
@@ -774,6 +774,12 @@ const PopupSwitchMenuItem = new Lang.Class({
             this.toggle();
         }
 
+        // we allow pressing space to toggle the switch
+        // without closing the menu
+        if (event.type() == Clutter.EventType.KEY_PRESS &&
+            event.get_key_symbol() == Clutter.KEY_space)
+            return;
+
         this.parent(event);
     },
 
index 7862477bfe848774ef8e5f1a01e6dc0fd5aa79f2..6c7de8ed6c1da9de2697aebf042d247d42d339c8 100644 (file)
@@ -613,7 +613,7 @@ const UserMenuButton = new Lang.Class({
         this._statusChooser = item;
 
         item = new PopupMenu.PopupSwitchMenuItem(_("Notifications"));
-        item.connect('activate', Lang.bind(this, this._updatePresenceStatus));
+        item.connect('toggled', Lang.bind(this, this._updatePresenceStatus));
         this.menu.addMenuItem(item);
         this._notificationsSwitch = item;